package com.totoro.tygeneratedragonblock.executor.action.impl;

import com.totoro.tygeneratedragonblock.constants.ActionConst;
import com.totoro.tygeneratedragonblock.data.ComputeResult;
import com.totoro.tygeneratedragonblock.executor.action.ActionExecutor;
import com.totoro.tygeneratedragonblock.utils.PapiUtil;
import com.totoro.tygeneratedragonblock.utils.StrUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import java.util.Map;

public class BcActionExecutor implements ActionExecutor {
    @Override
    public void execute(Map<String, ComputeResult> parseValueMap, String actionText, Player player) {
        actionText = parseValueMap(parseValueMap, actionText);
        if(null == actionText) {
            return;
        }
        actionText = StrUtil.getPrefixAfter(actionText, ActionConst.BC);
        actionText = PapiUtil.parseStrPapiVariable(player, actionText);
        Bukkit.broadcastMessage(actionText);
    }
}
